public class Test {
    //求1！+2！+3！+4！+........+n!的和
    public static int ret(int n) {
        if(n == 1) {
            return 1;
        }
        return n*ret(n-1);
    }

    public static int sum(int n) {
        int sum = 0;
        for (int i = 1; i <=n; i++) {
            sum += ret(i);
        }
        return sum;
    }

    public static void main(String[] args) {
        int sum = sum(5);
        System.out.println(sum);
    }
}
